package avicit.im.lantop.userauthset.service.api;


import avicit.platform6.core.rest.msg.ResponseMsg;
import avicit.platform6.core.restclient.RestClient;
import avicit.platform6.core.restclient.RestClientUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class UserAuthIntfsServiceApi {


    /**
     * 服务编码
     */
    private static final String SERVICE_CODE = "filebasicmanager";

    private static final String BASE_PATH = "/api/avicit/im/lantop/userauthset/rest/UserAuthIntfsServiceRest";

    @Autowired
    private RestClient restClient;


    /**
     *获取对记录有查看权限的用户ID串
     * @param authmlParam
     * @return
     */
    public Map<String, Object> getUserIdsAuthDatasByRecord(Map<String, Object> authmlParam) {
        String url = BASE_PATH + "/getUserIdsAuthDatasByRecord";
        Map<String, Object> map = new HashMap<>();
        map.put("authmlParam", authmlParam);
        ResponseMsg<Map<String, Object>> responseMsg = restClient.doPost(SERVICE_CODE, url, map, new ParameterizedTypeReference<ResponseMsg<Map<String, Object>>>() {
        });
        return RestClientUtils.getResponseBody(responseMsg);
    }
}
